﻿using System;
using System.Configuration.Provider;

namespace AnOtherBlog.Core.Providers
{
	public class DataProviderCollection : ProviderCollection
	{
		/// <summary>
		/// Obtiene un proveedor de acuerdo a su nombre
		/// </summary>
		/// <param name="name"></param>
		/// <returns></returns>
		public new DataProvider this[string name]
		{
			get
			{
				return (DataProvider)base[name];
			}
		}

		/// <summary>
		/// Agrega un proveedor a la colección
		/// </summary>
		/// <param name="provider">DataProvider object</param>
		public override void Add(ProviderBase provider)
		{
			if (provider == null)
			{
				throw new ArgumentNullException("provider");
			}
			if (!(provider is DataProvider))
			{
				throw new ArgumentException("Tipo de proveedor inválido", "provider");
			}
			base.Add(provider);
		}
	}

}
